package cn.wolfcode.p2p.business.domain;

import cn.wolfcode.p2p.base.domain.BaseAuditDomain;
import com.alibaba.druid.support.json.JSONUtils;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.text.DateFormat;
import java.util.Date;
import java.util.HashMap;

@Getter
@Setter
public class RechargeOffline extends BaseAuditDomain {

    //交易号
    private String tradeCode;
    //交易时间
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date tradeTime;
    //金额
    private BigDecimal amount;
    //备注
    private String note;
    //银行信息
    private PlatformBankInfo bankInfo;


    public String getJsonString() {
        HashMap<String, Object> map = new HashMap<>();
        map.put("id", id);
        map.put("username", applier.getNickName());
        map.put("tradeCode", tradeCode);
        map.put("amount", amount);
        map.put("tradeTime", DateFormat.getDateInstance().format(tradeTime));

        return JSONUtils.toJSONString(map);
    }
}